# in this file, we will create a test for soj.judgetask.oi.judge.OIProblem
from soj.judgetask.oi.judge import OIProblem
from pathlib import Path
import json
from soj.common.lang import Language
BASE_DIR=Path(__file__).parent.resolve()
def main():
    with open(BASE_DIR/"testproblem"/"meta.json","r+") as f:
        s=f.read()
        mt=json.loads(s)
    with open(BASE_DIR/"testproblem"/"scoring.json","r+") as f:
        s=f.read()
        sc=json.loads(s)
    oi=OIProblem(BASE_DIR/"testproblem"/"data",mt,sc)
    with open(BASE_DIR/"test.cpp","r+") as f:
        src=f.read()
    oi.init_partcipant(src,Language.CPP)
    res=oi.judge()
    print(res)
    print("JSON RESULT")
    print(oi.to_json())
    print(json.dumps(oi.to_json(),sort_keys=True))
    oi.release_partcipant()

if __name__=="__main__":
    main()